package com.thrd.taiexhibition.adapter;

import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.thrd.basicframework.bean.BaseRecyclerAdapter;
import com.thrd.taiexhibition.R;
import com.thrd.taiexhibition.bean.BeanEnterprationDown;

import java.util.List;

/**
 * @author: ${唐杰}
 * @date: 2021/4/1
 */
public class EnterpriseInfoSideslipAdapter extends BaseRecyclerAdapter<BeanEnterprationDown> {
    private int select=0;
    public EnterpriseInfoSideslipAdapter(Context context, List<BeanEnterprationDown> data) {
        super(context, data);
    }

    @Override
    public void bindData(BaseViewHolder holder, BeanEnterprationDown beanEnterprationDown) {
        TextView mText = (TextView) holder.getView(R.id.tv_text);
        View v2=holder.getView(R.id.v_view2);
        mText.setText(TextUtils.isEmpty(beanEnterprationDown.getProductDetailTitle())?"":beanEnterprationDown.getProductDetailTitle());
        if(select==holder.getAdapterPosition()){
            mText.setTextColor(Color.parseColor("#FFFFFF"));
            v2.setVisibility(View.VISIBLE);
        }else{
            mText.setTextColor(Color.parseColor("#AFB0B0"));
            v2.setVisibility(View.GONE);
        }


    }

    @Override
    public int getItemLayoutId() {
        return R.layout.item_enterprise_info_sideslip;
    }

    public void setSelect(int select) {
        int position=this.select;
        this.select = select;
        notifyItemChanged(position);
        notifyItemChanged(select);
    }
}
